<template>
    <el-container>
        <el-header style="text-align:left;height:15px;">
        <el-container>       

                <el-col>
                <span>讨论区</span>
                </el-col>
                 <el-col style="margin-right:500px">   
                     <el-link :underline="false" style="font-size:12px;color:rgb(106, 250, 118);"  @click="edit()">讨论区使用须知</el-link>
                </el-col>
               <div style="margin-right:100px">
                <el-input placeholder="请输入内容"  style="width:300px" v-model="select.title" class="input-with-select">
                    <el-select v-model="select.type" slot="prepend" placeholder="全部讨论区" style="width:100px" >
                    <el-option label="老师答疑区" value="老师答疑区"></el-option>
                    <el-option label="课堂交流区" value="课堂交流区"></el-option>
                    <el-option label="综合讨论区" value="综合讨论区"></el-option>
                    </el-select>
                    <el-button slot="append" icon="el-icon-search" @click="change()"></el-button>
                </el-input>
                </div>
         
        </el-container>       
        </el-header>

        <el-divider content-position="left" style="margin:5px"></el-divider> 
        <el-main>
             <router-view >
             </router-view>
        </el-main>
 <Edit :visible='visible' :title="title" :defaultFormData='defaultFormData' 
    v-if='visible' @close = 'close'/>
    </el-container>
    
</template>

<script>

import {setCookie} from '@/libs/cookie'
import Edit from '../../../edit/edit_rules'

export default {
    name:'study_discuss',
    inject:['reload'],
    components:{Edit},
    data(){
        
        return{
            input: '',
            
            select: {
                type:'全部讨论区',
                title:'',
                key:'0',
                pageNum:1
            },
            visible: false,
            defaultFormDate:{},
            title:''
        }
    },
    methods:{
        change(){
            setCookie("forum", JSON.stringify(this.select), {
                      expires: 7         
           })
           this.reload()
            this.$router.push("/discuss/content");
        },
        close(val){
            this.visible = false
      
        },
        edit(){
            this.visible = true
            this.title = '讨论区规则'
            this.defaultFormData = {}
      },
    }
}
</script>

<style scoped>
  .el-header {
    background-color: rgb(255, 254, 254);
    line-height: 20px;
  }
  .el-select .el-input {
    width: 130px;
  }
  .input-with-select .el-input-group__prepend {
    background-color: #fff;
    background-color: rgb(179, 171, 171);
  }

</style>